#!/bin/sh

chmod 755 "/System/Library/Extensions/Visual Presenter.kext/Contents/MacOS/Visual Presenter"
chmod 755 "/System/Library/Extensions/Visual Presenter.kext/Contents/PlugIns/Visual PresenterAudio.kext/Contents/MacOS/Visual PresenterAudio"
chmod 755 "/System/Library/Extensions/Visual Presenter.kext/Contents/PlugIns/Visual PresenterNoSeizeAppleUSBAudio.kext/Contents/MacOS/Visual PresenterNoSeizeAppleUSBAudio"
chmod 755 "/System/Library/Extensions/Visual Presenter.kext/Contents/PlugIns/Visual PresenterNoSeizeClassic.kext/Contents/MacOS/Visual PresenterNoSeizeClassic"
chown -R root:wheel "/System/Library/Extensions/Visual Presenter.kext"
chown -R root:wheel "/Library/StartupItems/Visual Presenter Startup"

# Get the OS revision
version=`sysctl -n kern.osrelease`
major=`echo $version | sed -e 's/\..*$//'`

# Use different AppleScript depending on the OS (10.2 or less does not support "applications folder")
if [ $major -lt 7 ]; then
	osascript -e "tell application \"Finder\" to open folder \"Applications:Visual Presenter\" of startup disk"
else
	osascript -e "tell application \"Finder\" to open folder \"Visual Presenter\" of (path to applications folder from system domain)"
fi

exit 0

